
<template>
	<!-- 添加弹框 -->
	<el-dialog title=""  :visible.sync="dialogTableVisible" class="wrap" @close="cancel" :close-on-click-modal="false">
		<i class="el-icon-close close" @click="cancel" style="color: white;z-index:10;"></i>
	    <div class="bt">插班报名</div>
		<el-form label-width="100px" class="form">
		<el-collapse v-model="activeNames" >
		<el-collapse-item title="基本信息" name="1">
				<el-form-item label="中文名" class="select-block">
 				<el-input v-model="vzwm" placeholder="请输入中文名" icon="add" ></el-input>
 			</el-form-item>

 			<el-form-item label="正式班级" class="select-block">
				<el-select v-model="ysbjid" placeholder="请选择..." >
					<el-option :label="v.mc" :value="v.id" v-for="v in ysbjList"></el-option>
				</el-select>
			</el-form-item>

 			<el-form-item label="英文名" class="select-block">
 				<el-input v-model="vywm" placeholder="请输入英文名" icon="add" ></el-input>
 			</el-form-item>

 			<el-form-item label="电话" class="select-block">
 				<el-input v-model="vdh" placeholder="请输入电话" icon="add" ></el-input>
 			</el-form-item>

 			<el-form-item label="缴费定金" class="select-block" >
 				<el-input v-model="yuer" placeholder="请输入缴纳定金" icon="add" ></el-input>
 			</el-form-item>
			<!--<el-form-item label="学号" class="select-block">
				<el-input v-model="vxh" placeholder="请输入学号" icon="add" ></el-input>
			</el-form-item>-->
 			<el-form-item label="性别" class="select-block">
				<el-select v-model="vxb"  placeholder="请选择性别" icon="add"  >
						<el-option label="男" value="男"></el-option>
						<el-option label="女" value="女" ></el-option>
				</el-select>
 			</el-form-item>

 		</el-collapse-item>

 			<el-collapse-item title="详细信息" name="2">
 			<el-form-item label="是否启用" class="select-block">
				<el-select v-model="visqy"  >
						  <el-option label="启用" value="Y"></el-option>
							<el-option label="禁用" value="N" ></el-option>
				</el-select>
 			</el-form-item>
 			<el-form-item label="年级班级" class="select-block">
 				<el-input v-model="vnjbj" placeholder="请输入年级班级" icon="add" ></el-input>
 			</el-form-item>
 			<el-form-item label="出生日期" class="select-block">
 				<el-input v-model="vcsrq" placeholder="请输入出生日期" icon="add" ></el-input>
 			</el-form-item>
 			<el-form-item label="父母手机号" class="select-block">
 				<el-input v-model="vfmdh" placeholder="请输入父母手机号" icon="add" ></el-input>
 			</el-form-item>
			<el-form-item label="微信号" class="select-block">
 				<el-input v-model="vwx" placeholder="请输入微信号" icon="add" ></el-input>
 			</el-form-item>
 			<el-form-item label="公立学校" class="select-block">
 				<el-input v-model="vglxx" placeholder="请输入公立学校" icon="add" ></el-input>
 			</el-form-item>

 			<el-form-item label="家庭地址" class="select-block" style='width: 100%;'>
 				<el-input v-model="vjtdz" placeholder="请输入家庭地址" icon="add" ></el-input>
 			</el-form-item>

 			<el-form-item label="招生来源" class="select-block" style='width: 100%;'>
 				<el-input v-model="vzsly" placeholder="请输入招生来源" icon="add" ></el-input>
 			</el-form-item>
 		    </el-collapse-item>
 		</el-collapse>

		</el-form>
		<el-button type="info" class="submit" @click="submit22(false)">保存</el-button>
		<!-- <el-button type="info" class="submit" @click="submit22(true)">保存并缴费</el-button> -->
		<el-button type="info" class="submit" @click="submit22(true)">保存并缴费</el-button>
		<!-- <router-link v-on:click.native="submit22(false)" :to="{path:'/cost/pay',query: {iid:this.xszwm,id:this.xsid}}" >
			<el-button type="info" class="submit" >保存并缴费</el-button>
		</router-link> -->
		<!-- v-on:click.native="submit22(false)" -->
		<!-- <router-link v-on:click.native="doSomethingCool"to="/cost/pay">跳转</router-link> -->
		<!-- <el-button type="info" class="submit" @click="submit22(false)">保a存</el-button>
    <el-button type="info" class="submit" @click="submit22(true)">保存并缴费1a</el-button> -->
	</el-dialog>
</template>
<script type="text/javascript">
	import qs from 'qs'
	export default {
		data() {
			return {
				vdh: '',
				vmm: '',
				vxb: '',
				vzwm: '',
				vywm: '',
				visqy: 'Y',
				vcsrq: '',
				vzsly: '',
				vfmdh: '',
				vwx: '',
				vjtdz: '',
				vglxx: '',
				vnjbj: '',
				yuer:'',
				vxh: '',
				activeNames:'1',
				ysbjid: this.$route.query.iid,
				dialogTableVisible: true,
				ysbjList:[],
				xsid:'',
				xszwm:'',
				 vbtime:'', // 开始时间
                vetime:'' ,// 结束时间
                 layout: 'total, sizes, prev, pager, next, jumper',//组件布局
			    pageindex: this.$store.state.pageindex,//当前分页页码
                pagesizes: this.$store.state.pagesizes,//显示个数的选择器选项
                pagesize: this.$store.state.pagesize,//每页显示条目数
                total: 0,//总条数
			}
		},
		created () {
			this.ysbj();
		},
		methods: {
			ysbj(){
				var logininfo = JSON.parse(localStorage.logininfo);
              this.searchLoading = true;
             var params2 = qs.stringify({
                      yhid: logininfo.id+'',
						xxid:logininfo.xxid+'',
						pageindex: this.pageindex+'',
                        pagesize: this.pagesize+'',
					    isqy:''+'',
                        keyword:''+'', // keyword
                        btime:''+'',
                        etime:''+''
               })
             //执行
                 this.axios.post(this.$store.state.api + 'bj/list',  params2 )
                 .then(res => {
                 console.log('11111',res)
//                console.log(this.dataList)/
                  let data = res.data.data;
                  let list = data.list;
                  this.total = data.totalPage;
                  this.ysbjList = list;
                  this.searchLoading = false;
                 }).catch(res => {
					 console.log(res)
                  this.searchLoading = false;
				})				
				
				
				
				
				
//				var logininfo = JSON.parse(localStorage.logininfo);
//				this.axios.get( this.$store.state.api + 'bj/list',{
//					params:{
//						yhid: logininfo.id+'',
//						xxid:logininfo.xxid+'',
//						pageindex: this.pageindex+'',
//                      pagesize: this.pagesize+'',
//					    isqy:''+'',
//                      keyword:''+'', // keyword
//                      btime:''+'',
//                      etime:''+''
//					}
//				})
//				.then( res => {
//                console.log('11111',res)
//                console.log(this.dataList)
//                let data = res.data.data;
//                let list = data.list;
//                this.total = data.totalPage;
//                this.ysbjList = list;
//                this.searchLoading = false;
//            }).catch( res => {
//                console.log(res)
//                this.searchLoading = false;
//            })
			},
			submit1(){
				this.$router.push({path:'/cost/pay',query: {iid:this.xszwm,id:this.xsid}})
			},
			submit22(isjiaofei) {
				// alert(1111);
				//检测
				this.$store.state.loading = true;
			   /* if(!this.mc) {
					this.$message.warning('请填写分类名称');
					this.$store.state.loading = false;
					return;
				} */
		var logininfo = JSON.parse(localStorage.logininfo);
		var params3 = qs.stringify({
							dh: this.vdh,
							xb: this.vxb,
							zwm: this.vzwm,
							ywm: this.vywm,
							isqy: this.visqy,
							csrq: this.vcsrq,
							zsly: this.vzsly,
							fmdh: this.vfmdh,
							wx: this.vwx,
							jtdz: this.vjtdz,
							glxx: this.vglxx,
							njbj: this.vnjbj,
							ysbjid:this.ysbjid,
							yuer:this.yuer,
							yhid: logininfo.id,
							xxid:logininfo.xxid
				});
				//执行
				this.axios.post(this.$store.state.api + 'xs/insert', params3)
					.then(res => {
						this.xsid = res.data.data.xsid
						this.xszwm = res.data.data.xszwm
						console.log(this.xsid)
						console.log(this.xszwm)
						if(res.data.code == 1) {
							if(isjiaofei){
								this.$emit('close', { type: 'chaban', cancel: false });
								this.submit1()
							}else{
								this.$emit('close', { type: 'chaban', cancel: false });
							}
							this.$store.state.loading = false;
						} else {
							this.$emit('close', { type: 'chaban', cancel: false });
							this.$store.state.loading = false;
						}
					}).catch(res => {
						this.$message.warning("服务器繁忙，请重试");
						this.$store.state.loading = false;
					})
			},
			cancel() {
				this.$emit('close', { type: 'chaban', cancel: true })
			},
			componentsShow (type,data) { //显示组件
                console.log(type,data)
                for ( let i in this.portComponents ) {
                    if (type == this.portComponents[i].type) {
                        this.portComponents[i].toggle = true;
                        this.portComponents[i].params = data;
                        if (this.portComponents[i].data.type == 'single') {
                            this.portComponents[i].data.index = data.row.id
                        }else if(this.portComponents[i].data.type == 'multiple'){
                            this.portComponents[i].data.index = this.multipleDelNum;
                        }else{
                            return;
                        }
                        return;
                    }
                }
            },
		}
	}
</script>
<style lang="less" scoped>
.wrap {
	text-align: center;
}
.bt{
		position: absolute;
		width: 100%;
		height: 50px;
		margin: 0 auto;
		top: 0;
		left: 0;
		background: #50BFFF;
		color:white;
		text-align:left;
		line-height: 50px;
		font-size: 17px;
		padding-left: 15px;
	}

.form {
	text-align: left;
}
 .input {
					width: 300px;
					display: inline-block;
			}

.select-block {
	// display: block;
	float: left;
	width: 45%;
}

.submit {
	width: 120px;
}
</style>
